let app = null;

Component({
  data: {
    selected: 0,
    list: [{
        "pagePath": "/pages/home/index",
        "iconPath": "/assets/images/tabbar1.png",
        "text": "首页"
      },
      {
        "pagePath": "/pages/fraternity/index/index",
        "iconPath": "/assets/images/tabbar2.png",
        "text": "联谊会"
      },
      {
        "pagePath": "/pages/my/index/index",
        "iconPath": "/assets/images/tabbar3.png",
        "text": "我的"
      }
    ]
  },
  lifetimes: {
    
    attached() {
      app = getApp();
      this.setData({ selected: app.globalData.selected });
    }
  },
  methods: {
    switchTab(e) {
      const { index, url } = e.currentTarget.dataset;
      //  修改全局的select值
      app.globalData.selected = index;
      wx.switchTab({ url });  //  页面跳转
    }
  }
})